package com.wyw.learning.thread.immutable;

import java.util.HashSet;
import java.util.Set;

/**
 * 一个属性是对象，但是整体不可变，其他类无法修改set里面的数据
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
public class ImmutableDemo {
    private final Set<String> students = new HashSet<>();

    public ImmutableDemo() {
        students.add("test1");
        students.add("test2");
        students.add("test3");
    }

    public boolean isStudent(String name) {
        return students.contains(name);
    }


}
